﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControls_goods_search_more : UCBase 
{
    public UserControls_goods_search_more()
    {
        Name = "高级搜索";
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadBrand();
        LoadType();
    }

    private void LoadBrand()
    {
        ddlGoodBrand.DataSource = new DAL.Tables.tbl_Shop_Brand().Open("", "Isuse = 1", "");
        ddlGoodBrand.DataTextField = "BrandName_CN";
        ddlGoodBrand.DataValueField = "ID";
        ddlGoodBrand.DataBind();
        ListItem item = new ListItem("所有品牌", "所有品牌");
        ddlGoodBrand.Items.Insert(0, item);
    }

    /// <summary>
    /// 绑定所属店铺所有商品类型
    /// </summary>
    private void LoadType()
    {
        ddlGoodType.DataSource =new DAL.Tables.tbl_Shop_GoodType().Open("", "", "");
        ddlGoodType.DataTextField = "TypeName";
        ddlGoodType.DataValueField = "ID";
        ddlGoodType.DataBind();
        ListItem item = new ListItem("所有类别", "所有类别");
        ddlGoodType.Items.Insert(0, "所有类别");
    }

    protected void ibOK_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("Default.aspx?PN=goods_search_list&Page=Search&BrandID=" + ddlGoodBrand.SelectedValue + "&TypeID=" + ddlGoodType.SelectedValue + "&GoodName=" + txtGoodName.Text + "&MinPrice="+txtMinPrice.Text+"&MaxPrice="+txtMaxPrice.Text+" ");
    }

    protected void ibCancel_Click(object sender, ImageClickEventArgs e)
    {
        Response.Write("<script>history.go(-2)</script>");
    }
}
